package controllers;

import java.util.List;

import models.News;
import models.Types;
import play.data.validation.Required;
import play.mvc.Controller;

public class Application extends Controller {

	public static void index() {

		String member = session.get("member");
		
		//取数量最多的6个出售/求购信息分类
		int topSize=4;
		
		List<Types> topSaleTypes = Types.getTopSaleTypes(topSize);
		List<Types> topTradeTypes = Types.getTopTradeTypes(topSize);
		
		int newsSize=7;
		List<News> lately = News.getLately(newsSize);
		
		
		
		render(topSaleTypes,topTradeTypes,lately);
	}

	public static void sayHello(@Required String myName) {

		if (validation.hasErrors()) {
			flash.error("Oops, please enter your name!");
			index();
		}
		render(myName);

	}

}